<include file="common/hearder"/>


<div class="page-header">
    <div class="pull-left" style="margin-left: 40%;color: #2b542c">
        <h3>部门信息管理</h3>
    </div>
</div>
<br><br>
<div class="pull-right">
    <form class="form-inline" action="{:U('index')}">
        <div class="form-group" >
            <div class="input-group">
                <div class="input-group-addon">搜</div>
                <input type="text" name="select" class="form-control" id="exampleInputAmount" placeholder="{$value ? $value : '请输入关键信息'}">
                <div class="input-group-addon">索</div>
            </div>
        </div>
        <button type="submit" value="1" name="search" class="btn btn-primary">查询</button>
    </form>
</div>
<div class="manage-left">
    <a class="btn btn-default" onclick="$('#display').submit();">清空</a>
  <a class="btn btn-default" href="{:U('index')}">返回上一页</a>
</div>
<div class="clearfix"></div>
<div class="table-margin">
    <form id="display" class="am-form" action="{:U('del_all')}">
        <table class="table table-bordered table-header">
            <thead>
            <tr>
                <td><input type="checkbox" class="check_all"></td>
                <td >部门编号</td>
                <td>公司编号</td>
                <td>部门名称</td>
                <td>管辖范围</td>
                <td>状态</td>
                <td>操作</td>
            </tr>
            <foreach name="list" item="dpt">
                <tr class="active">
                    <td><input type="checkbox" class="check_a" name="dpt_id[]" value="{$dpt.dpt_id}"></td>
                    <td class="warning">{$dpt.dpt_id}</td>
                    <td class="warning">{$dpt['cmpy_id']==1?'恩腾科技':'禁用'}</td>
                    <td class="warning">{$dpt.dpt_name}</td>
                    <td class="warning">{$dpt.dpt_bility}</td>
                    <td class="warning">{$dpt['state']==1?'启用':'禁用'}</td>
                    <td>
                        <a href="javascript:drop_confirm('该部门下面有相应的岗位,确定要删除这个部门吗？','__URL__/delete/dpt_id/{$dpt.dpt_id}')">删除</a>
                        <a href="{:U('display_a',array('dpt_id'=>$dpt['dpt_id']))}" class="glyphicon glyphicon-trash" style="text-decoration: none;">显示</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    {$show}
</div>
</div>
<script>
    <!--  全选和反选prop(); prop()方法设置或返回被选元素的属性和值-->
    $('.check_all').on('click',function () {
        if($(this).prop('checked')){
            $('.check_a').each(function () {
                if($(this).prop('checked')){
                    $(this).prop('checked',false);
                }else{
                    $(this).prop('checked',true);
                }
            });
        }else{
            $('.check_a').prop('checked',false);
        }
    });
</script>
<script>
function drop_confirm(message,pathurl)
{
if(confirm(message))
{
window.location.href=pathurl;
}else
{
return false;
}
}
</script> 
<include file="common/footer"/>